import scipy.signal
time = 0.33
Ts = 1.0/10000.0
t = linspace(0, time, time/Ts)
lent = len(t)
fc = 1000.0
c = cos(2*pi*fc*t)
fm = 20
w = 10/lent*linspace(1,lent+1,1)+cos(2*pi*fm*t)
v = c*w + c
fbe = [0, 0.025, 0.05, 0.5]
damps = [1,0]
fl = 100
b = scipy.signal.remez(fl, fbe, damps)
envv = (pi/2)*scipy.signal.lfilter(b,1,abs(v))
plot(w)
figure()
plot(v)
figure()
plot(envv)
def modAMLarge(x, fc, phase, Ts):
t = linspace(0, len(x)*Ts, len(x))
c = cos(2*pi*fc*t+phase)
w = x*c+c
return w
def demodAMLarge(v, fc, Ts):
fbe = [0, 0.025, 0.05, 0.5]
damps = [1,0]
fl = 100
b = scipy.signal.remez(fl, fbe, damps)
envv = (pi/2)*scipy.signal.lfilter(b,1,abs(v))
return envv
time = 0.3333
Ts = 1.0/20000.0
t = linspace(0, time, time/Ts)
fm = 20.0
fc = 1000.0
x = 10/time*t+cos(2*pi*fm*t)
v = modAMLarge(x, fc, 0, Ts)
envv = demodAMLarge(v, fc, Ts)
plot(x)
figure()
plot(v)
figure()
plot(envv)
5.1. Plot the spectrum of the message, the carrier, and the recieved signal. What is the spectrum of the envelope?
time = 0.3333
Ts = 1.0/20000.0
t = linspace(0, time, time/Ts)
fm = 20.0
fc = 1000.0
x = 10/time*t+cos(2*pi*fm*t)
v = modAMLarge(x, fc, 0, Ts)
envv = demodAMLarge(v, fc, Ts)
plotspec(x, Ts)
plotspec(v, Ts)
plotspec(envv, Ts)
5.2. One of the advantages of using large carrier AM is that you don't need the phase or frequency (exactly) of the transmitted signal. Verify
def testRecovery(phase):
fc = 1000.0
Ts = 1.0/20000.0
v = modAMLarge(x, fc, 0, Ts)
envv = demodAMLarge(v, fc, Ts)
vp = modAMLarge(x, fc, phase, Ts)
envvp = demodAMLarge(vp, fc, Ts)
return envvp-envv
d = testRecovery(0)
plot(d)